// ============================================================================
//
// LCP-net framework by Pierre CHATEL chatelp@gmail.com
// Distributed under GPLv3
// Copyright (C) THALES Land & Joint Systems, 2008, 2009. All rights reserved
//
// ============================================================================

package com.thalesgroup.preferenceFramework.models.LCPnet.util;

import com.thalesgroup.graphFramework.core.Vertex;
import com.thalesgroup.graphFramework.core.utils.DOTTools;
import com.thalesgroup.preferenceFramework.algorithms.DepthBasedWeights;
import com.thalesgroup.preferenceFramework.models.LCPnet.LNode;

public class LCPGraphSerializer extends DOTTools<LNode, Void> {
	@Override
	protected void feature(Vertex<LNode, Void> v, StringBuffer out) {
		if(v.getVertex()!=null) {
			out.append("label=\"");
			out.append(v.getVertex().getName());
			// Display meta-data alongside node's label
			out.append("(");
			out.append(v.getUserFeature(DepthBasedWeights.depthKey));
			out.append(", ");
			out.append(v.getUserFeature(DepthBasedWeights.weightKey));
			out.append(")");
			out.append("\" ");
		}
	}
}
